#
# Make translations
#
DIRS=da_DK de_DE el_GR fi_FI fr_FR hu_HU it_IT nl_NL no_NO pt_BR ro_RO ru_RU sr_YU 
#
# Want to skip one file out of top level dir
# Otherwise, TOPFILES would have been *.php
TOPFILES=credits.php enter-person.php estimates.php estimates-previous.php field-guide.php help.php index.php legal.php lost-key.php machine-form.php machine-update-form.php managers.php new-machine.php news.php renew.php
# In organization: skip drop-people.php and todo.php
ORGFILES=organization/board.php organization/charter.php organization/index.php organization/privacy.php organization/teams.php organization/translate.php organization/accounting.php
MAILFILES=../../temp/send18texts
FILES=$(TOPFILES) $(ORGFILES) $(MAILFILES) help/*.php person/*.php news/*.php reports/*.php scripts/*.php survey/*.php ../cgi-bin/*.cgi ../cgi-bin/*.pl ../cgi-adm/*.cgi ../../phpinc/counter2.php ../../phpinc/langchooser.php ../../phpinc/languages.php ../../lib-i18n/*.pm ../wwws/*.php ../wwws/adm/*.php ../wwws/login/*.php

default:
	@echo "Use make gather to gather strings out of all source files"
	@echo "Use make merge to merge the gathered strings to all translations"
	@echo "Use make install to install the translated files"

gather: Main
	../../tools/send18mail --dump > ../../temp/send18texts
	cd ../www; xgettext -C $(FILES) --keyword=_ --keyword=__ -o ../translations/Main/messages.po
	for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ; \
	do \
	cd ../www; xgettext -j -C bycountry/$$i*.php --keyword=_ --keyword=__ -o ../translations/Main/messages.po; \
	done

clean-po-file:
	cd Main; grep -v "#: bycountry" messages.po |grep -v "# bycountry" > messages.po-cleaned; cp messages.po-cleaned messages.po; cd ..; \

merge: Main/messages.po
	for dir in $(DIRS); do \
		(cd $$dir && make merge); \
	done
install:
	for dir in $(DIRS); do \
		(cd $$dir && make install); \
	done

Main:
	mkdir Main
